#include "smoke.h"
#include<QCoreApplication>


//Smoke::Smoke(int winHeight, int h1, int x, int groundHeight,QObject* parent): QObject(parent)
//{

//    this->h1 = h1;
//        this->x = x;
//        this->groundHeight = groundHeight;
//        this->winHeight = winHeight;
//        insmoke();

//}
void Smoke::insmoke()
{
    furong=QImage("://Saved Pictures/furong.png");
    mirror=furong.mirrored(false,true);

    fr1=QPixmap::fromImage(furong);
//    fr1=fr1.copy(0,0,fr1.width(),h1);
    fr1=fr1.scaled(width,groundHeight-h1-Cwidth);
    fr2=QPixmap::fromImage(mirror);
    fr2=fr2.scaled(width,h1);
}

void Smoke::draw(QPainter &painter)
{
    insmoke();
    painter.drawPixmap(x,0,fr2);//画上管道
    painter.drawPixmap(x,h1+Cwidth,fr1);//画下管道
}

void Smoke::setx(int x1)
{
    x=x1;
}
//Smoke::Smoke(int h)
//{

//    h1=h;
////    h1=M->random(20,700);

//}

void Smoke::seth1(int h)
{
    h1=h;
}
int Smoke::getx()
{
    x=this->x;
    return x;
}
int Smoke::gety()
{
    y=this->y;
    return y;
}
Smoke::~Smoke()
{

}
